	#include "gui.h"
#include "DarkGDK.h"

int GuiItem::GetPosX(void)
{

return X1;

}

int GuiItem::GetPosY(void)
{

return Y1;

}	

void GuiItem::MoveTo(int iX1, int iY1)
{
X1 = iX1-10;
Y1 = iY1-10;
X2 = iX1+Height;
Y2 = iY1+Width;
} 






void GuiItem::Debug(int X, int Y, int Z)
	{  

	
		// Display X PlayerTile
        char x [ 256 ] = "";
		strcpy ( x, "X = " );
		strcat ( x, dbStr ( X ) );
		dbText ( dbScreenWidth ( ) - 20 - dbTextWidth ( x ), dbScreenHeight ( ) - 60, x );
       
		// Display Z Player Tile
		char y [ 256 ] = "";
		strcpy ( y, "Y = " );
		strcat ( y, dbStr ( Y ) );
		dbText ( dbScreenWidth ( ) - 20 - dbTextWidth ( y ), dbScreenHeight ( ) - 80, y );
      
		// Display dbMouseClick(); Status.
		char z [ 256 ] = "";
		strcpy ( z, "MouseOver = " );
		strcat ( z, dbStr ( Z ) );
		dbText ( dbScreenWidth ( ) - 20 - dbTextWidth ( z ), dbScreenHeight ( ) - 100, z );
	
	}


GuiItem::GuiItem(int iX1 , int iY1 , int iX2 , int iY2 )
{
X1 = iX1;
Y1 = iY1;
X2 = iX2;
Y2 = iY2;
Height = Y2 - Y1;
Width = X2 - X1;

   dbBox( X1,Y1,X2,Y2 );

}

GuiItem::~GuiItem()
{
}

 void GuiItem::GuiUpdate()
{
  dbBox( X1,Y1,X2,Y2 );
}
 int mousex =0;
 int mousey =0;

 int GuiItem::IsMouseAtResize()
 {
   mousex = dbMouseX();
   mousey = dbMouseY();
   if ( mousex < X2 && mousex > X1 + Width - 30 && mousey < Y2 &&  mousey > Y1 + Height - 30 )
   {
	   return 1;
   } else 
   { 
	   return 0; 
   }
 }

 int GuiItem::IsMouseOver()
 {
   mousex = dbMouseX();
   mousey = dbMouseY();
 
   if ( mousex < X2-10 && mousex > X1 && mousey < Y2-10 &&  mousey > Y1 )
   {
	   return 1;
   } 
     else 
   { 
	   return 0; 
   }
 }

 void GuiItem::ResizeTo(int iX1, int iY1)
{
X2 = iX1;
Y2 = iY1;
Height = Y2 - Y1;
Width = X2 - X1;
}		